import request from '../../../request'

/**
 * 登录
 * 得使用kantboot为后端框架
 */
let login = ()=>{
    return new Promise((resolve, reject) => {
        uni.login({
            provider: "weixin",
            success: (res) => {
                request.request({
                    url: "/functional-third-party-web/wechat/loginInMp",
                    method: "POST",
                    data: {
                        code: res.code
                    },
                    stateSuccess: (resSuccess) => {
                        resolve(resSuccess);
                    },
                    stateFail: (resFail) => {
                        reject(resFail);
                    }
                });
            }
        });
    });
}

export default {
    login
}